<#include "/included/view_meta_global.ftl">
<body>
<div id="maxw"> 
<!-- header part -->
<#include "/included/header_global.ftl">
<!-- end header part -->
<script>
function postReply(){
	if(!document.getElementById("comment").value){
		document.getElementById("warnMessage").innerHTML="comment can't be null<br>";
		return false;
	}else{
		$("#butReply").attr('disabled','true');
		document.postform.submit();
	}
}

shortcut.add("Ctrl+return",function() {
	postReply();
});

function commentFocus(){
	$("#comment").focus();
}
</script>
<div id="leftpart">
	<br><span class="title">${article.title?if_exists}</span><br>
	<span>${article.post_time?string("yyyy-MM-dd HH:mm")}&nbsp;posted by <a href="/codebush/home/profile?uid=${article.user_id}">${article.user_name}</a></span>&nbsp;&nbsp;&nbsp;
	<a href="javascript:onClick=commentFocus();">Post Reply</a>&nbsp;&nbsp;&nbsp;
	<a href="../home/email?aid=${article.id}"><img src="/codebush/resource/im/email_subject.gif" class="email" title="email this article to your friend"></a>
	<#if Session.userId?exists>
		<#if Session.userId?number == article.user_id>
		<a href="../home/modify?aid=${article.id}">编辑</a>&nbsp;<a href="../home/delete?aid=${article.id}">删除</a>
		</#if>
	</#if>
	<br><br>
	<div class="content">${article.content}<br></div><br>
	<h2>豆瓣成员常用的标签&nbsp; ·&nbsp; ·&nbsp; ·&nbsp; ·&nbsp; ·&nbsp;·&nbsp;</h2>
	<div><#list articleTags as tag>
			<span style="border-bottom: 1px dotted rgb(221, 221, 221); line-height: 200%;">
				  <a href="/codebush/subject/tag?ti=${tag.id}">${tag.name}</a></span>&nbsp;
		 </#list></div>
	<h2>回应 (${comments?size}条) &nbsp; ·&nbsp; ·&nbsp; ·&nbsp; ·&nbsp; ·&nbsp;·&nbsp;</h2>
	<#list comments as comment>
	<div class="replyImg"><img src="/codebush/resource/ulogoim/${comment.user_id?if_exists}.jpg"></div><a name="${comment.id?if_exists}"></a>
	<div><li><span class="replyTitle">${comment.title?if_exists}</span></li>
		 <li><span>${comment.post_time?string("yyyy-MM-dd HH:mm")}&nbsp;</span>
			 <span class="replyUser">posted by <a href="/codebush/home/profile?uid=${comment.user_id}">${comment.user_name}</a>&nbsp;&nbsp;&nbsp;
			 	<a href="javascript:onClick=commentFocus();">Post Reply</a>
			 	<#if Session.userId?exists && Session.userId?number == article.user_id>
			 	<a href="deleteComment?cid=${comment.id?if_exists}&aid=${article.id}">delete</a>
			 	</#if></span></li></div>
	<div class="replyContent">${comment.content}</div><br><br>
	</#list>
	<#if Session.userId?exists>
	<div>
		<h2><a name="postReply"></a>你的回应 &nbsp; ·&nbsp; ·&nbsp; ·&nbsp; ·&nbsp; ·&nbsp; ·&nbsp;</h2>
	    <form method="post" id="postform" name="postform" action ="reply?aid=${article.id}">
	    <span id="warnMessage" class="warnMessage">${warnMessage?if_exists}</span>
        <textarea name="comment" id="comment" rows="8" cols="54"></textarea><br>
        <input value="post your comment" onclick="postReply()" id=butReply type="button"><span class="tip" style="font-size:0.9em;">(Ctrl+Enter)</span></form>
    </div>
    <#else>
    <div><h2>登录以后才可以发表评论哦&nbsp; ·&nbsp; ·&nbsp; ·&nbsp; ·&nbsp; ·&nbsp; ·&nbsp;</h2></div>
    </#if>
</div>

<!-- 右半边 right side part -->
<div id="rightpart">
<#if Session.userId?exists && Session.userId?number == article.user_id>
<p><a href="/codebush/subject/threadAdd:LinkAlias?aid=${article.id}">add a userfriendly link name to this article</a>
</#if>
<#include "/included/rightside_global.ftl"></div>
<!-- end 右半边  right side part -->

<!-- 底部 footer  -->
<#include "/included/footer_global.ftl">
<!-- end  底部 footer  -->
</div>
</body>
</html>